#!/usr/bin/env python
# encoding: utf-8

from web.contrib.template import render_mako

def _lookup(*a, **kwargs):
    from mako.lookup import TemplateLookup
    return TemplateLookup(*a, **kwargs)

    def __getattr__(self, name):
        # Assuming all templates are html
        path = name + ".html"
        t = self._lookup
        return t.render

lookup = _lookup(
        directories=['templates'],
        input_encoding='utf-8',
        output_encoding='utf-8',
        )

def render(path, **kwargs):
    return lookup.get_template(path).render(**kwargs)

import pymongo
db = pymongo.Connection().tbkanban